-
Notifications
You must be signed in to change notification settings - Fork 56
feat(frontend): display detailed balance information on AccountDetails page #447
Conversation
Your Render PR Server URL is https://near-explorer-frontend-pr-447.onrender.com. Follow its progress at https://dashboard.render.com/web/srv-btv5o2ipp1jok35lodv0. |
491f774 commit is current version which uses RPC and our database to get lockup balance and timestamp, which is workable. But I also tried to use viewLockupState function in the https://github.com/near/account-lookup/blob/master/script.js which is really weird. I want to show up here to to get some help. |
I find out it is the issue for account-lookup not from mine. That one cannot be used since I think our function to decode uint8array is weird . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
frontend/src/components/accounts/__tests__/__snapshots__/AccountDetails.test.tsx.snap
Outdated
Show resolved
Hide resolved
Co-authored-by: Vlad Frolov <frolvlad@gmail.com>
@icerove I have moved the logic to the backend since fetching the genesis config and doing a view call to the lockup contract needs to be done through it anyway (instead of using near-api-js on the client; we should not use RPC from the client side since we may end up providing inconsistent data from the backend and the direct RPC calls from the browser, so it is better to use backend to do all the calls to NEAR RPC). The changes are half-backed, please, finish them up (mostly on the frontend side, I believe). |
availableBalance: "43454321345678765432345678", | ||
totalBalance: "9876545678765432134567876543", | ||
storageUsage: "876", | ||
lockupTotalBalance: "765654565324543", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add a test for an account without lockup account information
</Row> | ||
{account.lockupTotalBalance && ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that we will miss the total balance information if there is no information about the lockup balance. This should not be the case
@@ -18,36 +19,55 @@ export interface Props { | |||
export default class extends React.Component<Props> { | |||
render() { | |||
const { account } = this.props; | |||
console.log(account); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the log
fix #291
Total Balance = Account balance + Lockup balance (wallet is + unlockup balance, but frol said it is wrong)
Available Balance = Account Balance - Minimum Balance
Minimum Balance = Bytes used * cost per byte
Lockup Balance = get_lockup_balance (wallet usage)
Staked Balance = Current “Locked Balance”